<template>
  <div class="wrapper">
    <swiper  v-if="showSwiper">
      <swiper-slide :options="swiperOption" v-for="item in swiper" :key="item.id"  >
        <img class="swiper-img" :src="item.imgUrl">
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
import {swiper, swiperSlide} from 'vue-awesome-swiper'

export default {
  name: 'Swiper',
  components: {
    swiper,
    swiperSlide
  },
  props:{
    swiper: Array
  },
  data() {
    return {
      swiperOption: {
        pagination:'.swiper-pagination',
        loop:true,
      },
      // swiperList:[{
      //   id:'0001',
      //   imgUrl:'https://imgs.qunarzz.com/vs_ceph_vcimg/e99689b007a63a3e9a1df56a4fc97131.jpeg'
      // },{
      //   id:'0002',
      //   imgUrl:'https://ad-dapp-osscp.qunarzz.com/ad_dapp_oss_oper/6f0237182ee000924615f5bc1b5c2d75.jpg'
      // },]
    }
  },
  computed:{
    showSwiper(){
      return this.swiper.length
    }
  }
}
</script>

<style lang="stylus" scoped>
.wrapper >>>.swiper-pagination-bullet-active
  background #fff !important

.wrapper >>>.swiper-pagination {
  position absolute
  top: 88%;
  left: 50%;
}

.wrapper
  position relative
  overflow hidden
  width: 100%
  height: 0
  padding-bottom: 30%

  .swiper-img
    width: 100%
</style>
